home *** CD-ROM | disk | FTP | other *** search
Text File | 1994-10-26 | 3.4 KB | 79 lines | [TEXT/ttxt] |
- About Ulf's circuits…
-
- This examples are given by Ulf Dittmer (ucdittme@top.cis.syr.edu)
- Thanks to him !
-
-
- • 2-complement Add/Subtract
-
- It's an Add/Subtract circuit for
- 4 bit numbers in 2-complement notation. In this notation a
- number and its negative add up to 2**n, where n is the number
- of bits used (4 in this case). So -1 equals 1111 and -8
- equals 1000 (and there is no +8). The nice thing about
- 2-complement is that subtraction can be done by adding the
- bit-inverse of the subtrahend and adding 1. So I use an
- input to distinguish between addition and subtraction
- (which must be 0 for adding and 1 for subtracting) and
- feed this as an additional signal in the adder of the lowest
- significant bit (Note that this was formerly a half adder;
- it's now a full adder). An overflow occurs if the carry-out
- signals of the two most significant bits are not equal.
-
-
-
- • 4 bit Shift Latch
-
- This is basically a 4 bit Flip-Flop with two inputs that control
- what happens when the clock input is triggered. It is built from
- your "DFF" Flip-Flop.
-
- Input1 Input2 what happens
- -------------------------------
- 0 0 nothing
- 0 1 the input values are stored in the latch
- 1 0 shift left, the "inL" (for Input Low) value
- goes into cell 0, the value in cell 3 is lost
- 1 1 shift right, the "inH" (for Input High) value
- goes into cell 3, the value in cell 0 is lost
-
- • 4 bit multiplier
-
- This circuit is really complex, awkward to use and sloooow.
- (Perhaps you do not want to include it in the distribution. :-)
- (yes, but Quadra950 recommanded !!! - Arnaud)
- The basic usage is: put your two factors in a0-a3 and b0-b3, then
- use the Clock/Initialize/Add/Shift inputs in the correct manner
- and - presto! - the result is shown in p0-p7 and the display.
- (Note: this works with UNSIGNED 4 bit numbers, for the sake of
- simplicity :-)
-
- Now what is a correct usage ?
- - load your multiplicands in a and b
- - set "Initialize" to 1
- - press the "Clock" button
- - set "Initialize" to 0
- - Now the latches "A" and "B" have the factors loaded.
- - Repeat the following six steps n times (n=4 in this case):
- - set "Add" to 1
- - press the "Clock" button
- - set "Add" to 0
- - set "Shift" to 1
- - press the "Clock" button
- - set "Shift" to 0
- - Now p shows the result.
- - In fact, the first three of the six steps can be omitted in
- every iteration in which the "out0" value of Latch "A" is
- zero, because nothing would be added.
-
- I tried to automate this sequence in a simple way, but it did not
- work. So I guess I have to take the conventional, complex way.
- To use the circuit for another multiplication it is not sufficient
- to just initialize it with new factors. You have to manually clear
- the latches. Also a thing that could be automated. As I said,
- awkward to use and a lot to be improved (not to mention signed
- numbers...).
-
- PS: there are stimulis that take much of the pain of using it out of it. Just
- type in the two multiplicands in the first eight lines and you're ready to go.
-